package com.lagou;

import redis.clients.jedis.*;

import java.util.HashSet;
import java.util.Set;

public class JedisClient {

    private static JedisCluster jcd = null;
    static {
        JedisPoolConfig config = new JedisPoolConfig();
        config.setMaxTotal(500);
        config.setMaxIdle(5);
        config.setMaxWaitMillis(10 * 1000);
        config.setTestOnBorrow(true);
        Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
        jedisClusterNode.add(new HostAndPort("192.168.8.103", 7001));
        jedisClusterNode.add(new HostAndPort("192.168.8.103", 7002));
        jedisClusterNode.add(new HostAndPort("192.168.8.103", 7003));
        jedisClusterNode.add(new HostAndPort("192.168.8.103", 7004));
        jedisClusterNode.add(new HostAndPort("192.168.8.103", 7005));
        jedisClusterNode.add(new HostAndPort("192.168.8.103", 7006));
        jcd = new JedisCluster(jedisClusterNode, config);
    }



    public static JedisCluster getJedisCluster() {
        return jcd;
    }
}
